//
// Created by Tunm-Air13 on 2024/3/14.
//
//#include "predictor.h"
#include "log.h"
#include "simple_semantic.h"
#include "serror.h"
#include "labels.h"

using namespace solex;


std::vector<std::string> semantics = {
        "给我推荐一周的菜单，每天3菜1汤，不要重复",
        "今天想吃牛毽子肉，给我推荐几个做法",
        "周一和周三的菜单里要一些海鲜，做法清蒸",
        "周二和周五健身，帮我搭配成减脂餐",
        "周六有上海朋友来家里做客，帮我生成一份6人的菜单，口味偏上海口味一些，菜单里要有帝王蟹和牛肉",
        "红膏炝蟹怎么做？",
        "八宝鸭怎么做？",
        "开始做饭",
        "帮我设定30分钟的闹钟",
        "打开垃圾处理器",
        "开启下水管疏通",
        "今天天气怎么样？",
        "开启下水管除菌",
        "卤牛肉用牛的什么部位更合适？",
        "请打开100毫升的水",
        "水温调节45度",
};

int main() {

    std::string folderPath = "../pack";

//    Predictor::PredictorParameter param;
//    param.folderPath = folderPath;
//
//    Predictor::GetInstance()->Initialization(param);
//
//    Predictor::PredictResult result;
//    Predictor::GetInstance()->AnalyseSentence(text, result);

    Sentence text = "帮我设定320分钟的闹钟";
    Configuration config;
    config.folderPath = folderPath;
    auto ret = InitSimpleSemantic(config);
    if (ret != SSUCCEED) {
        LOGE("出现错误: %d", ret);
    }

    AnalysisResult result;
    AnalysisOfSentence(text, result);

    auto idx = result.clsIndex;
    switch (idx) {
        case -1:
            LOGD("未匹配到命令: %f", result.probability);
            break;
        case 0:
            LOGD("%s(%d) : %f", COMMAND_LABELS[result.clsIndex].second.c_str(), result.specialInt[0], result.probability);
            break;
        case 1:
            LOGD("%s(%d) : %f", COMMAND_LABELS[result.clsIndex].second.c_str(), result.specialInt[0], result.probability);
            break;
        default:
            LOGD("%s : %f", COMMAND_LABELS[result.clsIndex].second.c_str(), result.probability);
    }

    return 0;
}